import { observable, action, computed } from "mobx";

import { Base64 } from 'js-base64';
import { Tools } from 'weaver-mobile';

export const styleNames = ["backColor", "foreColor", "hAlign", "vAlign",
    "font", "formatter", "borderLeft", "borderTop", "borderRight",
    "borderBottom", "diagonalDown", "diagonalUp", "locked", "textIndent",
    "wordWrap", "shrinkToFit", "backgroundImage", "backgroundImageLayout",
    "tabStop", "textDecoration", "imeMode", "watermark", "cellPadding",
    "labelOptions", "quotePrefix", "isVerticalText"];
    
const { getLabel } = Tools;

export default class TaskViewExcelStore {
    @observable title = '';
    @observable activeCellName = '';
    @observable isInit = false;
    @observable loading = false;
    @observable showDetailDelete = false;
    @observable customFuns;
    @observable oldPage;
    @observable excelStore;
    @observable uploadtitle = getLabel('502835', '导入数据');
    @observable visible = false;
    @observable pageid = '';
    @observable needCheck = true;
    deletedRows = {};
    func = [];

    @observable loadingPage = true;
    @observable isRight = false;
    @observable cuscode = '';
    @observable rowControl = {};
    @observable autoSaveDatas = [];
    @observable firstSet = false;
    @observable autoSaveDatasvisible = false;
    @observable canSubmit = false;
    @observable requiredCellBoderStyle = {};
    @observable requiredCellName = "";
    @observable fieldAssignList = [];
    @observable isAssign = true;//其他cell.value操作时是否执行数据源赋值逻辑
    @observable detailFields = [];//取excel表格中的所有子表字段
    @observable mainFields = [];//取excel表格中的所有主表字段
    customBindingCurrentT = {};
    customExpandFieldname = {}; // 一对多的字段，bindingPath需要单独设置
    customExpandCurrent = {};//扩展字段编号维护
    @observable otherrightExpandMap = {};
    @observable pgvisible = false;
    @observable uploadName;
    @observable progress = 0;
    @observable autoFitSheetMap = {};
    @observable uploadPids = [];
    @observable changeFieldList = [];
    @observable timer = {};
    @observable detailFieldInfoMap = {}
    @observable mainFieldInfoMap = {}
    tableFirstRowHeight = {};

    @action loadWorkbook = () => {
        this.isInit = true;
    }
    @action initWorkbook = (workbook, readonly) => {
        this.workbook = workbook;
        window.workbookInstance = workbook;
        this.readonly = readonly;
    }
}